<?php require_once('Connections/CSRE_Connection.php'); ?>
<?php include('CSRE_login_control.php') ?>

<table width="100%" class="text_form" cellspacing="0" cellpadding="3" 
	bordercolor="#5995CA" style="border:  thin solid; font-family:Verdana, Arial, Helvetica, sans-serif;">
	<thead style="background-color: #8EA5D9; color:#FFFFFF; font-weight:bold;">
		<tr align="center">
			<td>No. CSRE Produit</td>
			<td>Description</td>
			<td>Qt&eacute;</td>
			<td>Co&ucirc;t</td>
			<td>Total</td>
		</tr>
	</thead>
	<tbody>
	<?php 
	
	function fraisService() {
		return 10;
	}
	
	if (isset($_SESSION["products"])) {
		
		$total = 0;
		$keys = array_keys($_SESSION["products"]);
		
		foreach ($keys as $key) {
			mysql_select_db($database_CSRE_Connection, $CSRE_Connection);
			$query_productById = sprintf("SELECT * FROM csre_product WHERE product_id = %s", $key);
			$productById = mysql_query($query_productById, $CSRE_Connection) or die(mysql_error());
			$row_productById = mysql_fetch_assoc($productById);
			$totalRows_productById = mysql_num_rows($productById);
			
	?>
	
	<tr>
		
		<td>
			<a href="CSRE_product_search.php?search=search&filter=numcsre&filterValue=<?php echo $row_productById['csre_number']; ?>"><?php echo $row_productById['csre_number']; ?>
		</td>
		
		<td>
			<?php echo $row_productById['name_FR']; ?>
		</td>
		
		<td>
			<table width="100">
				<tr>
					<td>
					<input type="text" name="cant_<?php echo $key; ?>" id="cant_<?php echo $key; ?>"
						value="<?php echo $_SESSION["products"][$key]['units']; ?>" 
						onBlur="changeCant(this.id, this); Ajax('CSRE_modal_cart.php', 'cart');"
						style="width: 50px;" />
					</td>
					<td>
						<img src="images/csre/1305990737_DeleteRed.png" onclick="deleteProd(<?php echo $row_productById['product_id'];  ?>); Ajax('CSRE_modal_cart.php', 'cart');">
					</td>
				</tr>
			</table>
	    </td>
		
		<td align="right" width="100">$&nbsp;<?php echo $row_productById['price']; ?>
	    </td>
		
		<td align="right" width="100">
			$&nbsp;<?php echo($_SESSION["products"][$key]['units'] * $row_productById['price']); $total = $total + $_SESSION["products"][$key]['units'] * $row_productById['price']; ?>
		</td>
	</tr>
	<?php
		}
	}
	?>
	</tbody>
</table>
<div style="width: 100%; text-align:right; padding-top: 20px;">
	<input type="button" onclick='overlay()' value="Close" />
</div>


